package com.showgood.socket;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class SocketCommandCodecFactory implements ProtocolCodecFactory {
	
	@Autowired
	@Qualifier("socketCommandEncoder")
	private ProtocolEncoder encoder;
	
	@Autowired
	@Qualifier("socketCommandDecoder")
	private ProtocolDecoder decoder;
	
	public SocketCommandCodecFactory() {
		
	}
	
	@Override
	public ProtocolDecoder getDecoder(IoSession session) throws Exception {
		return decoder;
	}

	@Override
	public ProtocolEncoder getEncoder(IoSession session) throws Exception {
		return encoder;
	}

}
